How to Change a Control's Label at Runtime

Description

The text for a control's label can be set at runtime with JavaScript.

Discussion

{dialog.object}.getPointer() can be used to get a pointer to a control's label or container. This allows you to do dynamically change a label or re-style a container at runtime:

//Change the label for the FIRSTNAME field
//Get a pointer for the 'FIRSTNAME' field's label and set the text
var ele = {dialog.object}.getPointer('FIRSTNAME','label');
if (ele) {
    ele.textContent = 'New label for Firstname';
}

//put a blue border around the FIRSTNAME field
var ele = {dialog.object}.getPointer('FIRSTNAME','container');
if (ele) {
    ele.style.border = 'solid 1px blue';
}

See Also